<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="java.util.*" %>
<%@ include file="/page/taglibs.jsp" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<%@ include file="/adapter/adapter-bootstrap.jsp" %>
</head>
<script type="text/javascript">
function deletePageParamTag(){	
	
	if(recordKey!=""){
		if(p_del()){
		    $.ajax({
		        url:"${ctx}/sPageParamTag/deleteSPageParamTag?recordKey="+recordKey,
		        type: "POST",      
		        dataType:"json",
		        async: false,
		        success: function(data) {
		        	if(data.flag>0){
			            alert("删除成功！");	
			            window.location.reload();
		        	}
		/* 	          $.each(data, function(index, element) {
		             window.location.reload();
		          }); */
		        },
		        error: function() {
		          alert("error");
		        }
		      });
		}

	}else{
		alert("请选择要删除的渠道信息！");
	}

}

function createPageParamTag(){
	window.location.href="${ctx}/sPageParamTag/jumpCreatePage?pageId=${pageId}";
	//window.showModalDialog("${ctx}/sPageParamTag/jumpCreatePage?pageId=${pageId}","dialogwidth:1200px;   dialogheight:600px;   center:yes;   Help:No;   Resizable:No;   Status:Yes;   Scroll:Yes;   Status:no;   resizable:Yes ");

}

function editPageParamTag(){
	window.location.href="${ctx}/sPageParamTag/jumpCreatePage?recordKey="+recordKey+"&pageId=${pageId}";
}

function viewPageParamTag(){
	window.location.href="${ctx}/sPageParamTag/jumpViewPage?recordKey="+recordKey+"&pageId=${pageId}";
}

function p_del() { 
	var msg = "您真的确定要删除吗？\n\n请确认！"; 
	if (confirm(msg)==true){ 
	return true; 
	}else{ 
	return false; 
	} 
} 
</script>
<body>

<div class="panel panel-default">
   <div class="panel-heading">
      <h3 class="panel-title">
          请输入查询条件
      </h3>
   </div>
   <div class="panel-body">
<form class="form-horizontal" role="form" method="post" action="${pageContext.request.contextPath}/sPageParamTag/querySPageParamTagList.do?pageId=${pageId}">
                       <div class="form-group">
                          <label class="col-xs-1 control-label" for="qbcode">归属参数代码</label>
                          <div class="col-xs-3">
                             <input class="input-sm form-control" id="qbcode" name="qbcode" value="" type="text"/>
                          </div>
                          <label class="col-xs-1 control-label" for="qbname">标签名称</label>
                          <div class="col-xs-3">
 									<input class="input-sm form-control" name="qbname" id="qbname" value="" type="text" />
                          </div>
                          <div class="col-xs-3">
                          	 <button type="submit" class="btn btn-default btn-sm" >查询</button>                          
                          </div>
                       </div>
                      		<!-- </form> -->



			<div>
				<input type="button" class="btn btn-default" value="添加标签参数" onclick="createPageParamTag();"/>
				<input type="button" class="btn btn-default" value="删除标签参数" onclick="deletePageParamTag();"/>
				<input type="button" class="btn btn-default" value="编辑标签参数" onclick="editPageParamTag();"/>
				<input type="button" class="btn btn-default" value="查看标签参数" onclick="viewPageParamTag();"/>
			</div>	
<%-- <macms:table dataListName="acfList">
	<macms:html id="ch" label="选择" innerHtml="<input type=\"radio\" name=\"check\" value=\"15\">"></macms:html>
	<macms:text id="app_id" label="应用标识"></macms:text>
	<macms:text id="forward_channel_id" label="转发渠道标识"></macms:text>
	<macms:text id="forward_channel_name" label="转发渠道标识"></macms:text>
	<macms:text id="forward_channel_type" label="转发渠道类型"></macms:text>
	<macms:text id="forward_channel_url" label="转发地址"></macms:text>
</macms:table> --%>


			<table class="table table-bordered" style="" width="100%" cellspacing="1" cellpadding="0" border="0">
				<thead>
					<tr align="center" class="active">
					    <td>选择</td>
					    <td>标签唯一标识</td>
					    <td>归属页面标识</td>
					    <td>归属参数代码</td>
						<td>标签名称</td>
						<td>标签类型</td>
						<td>标签取值</td>
					</tr>
				</thead>				
				<tbody>
					<c:forEach items="${pageParamTagList}" var="pageParamTag" varStatus="s" >
 						<tr align="center">
 						    <td><input type="radio" name="check" id="check" value="15"></input></td>
							<td>${pageParamTag.recordKey}</td>
					        <td>${pageParamTag.pageId}</td>
					        <td>${pageParamTag.templateParamCode}</td>
							<td>${pageParamTag.tagName}</td>
							<td>${pageParamTag.tagType}</td>
							<td>${pageParamTag.tagValueSrc}</td>						
						</tr> 		
						</c:forEach>																					
				</tbody>
			</table>
			
					<%@ include file="/page/page.jsp" %>

</form>
   </div>
</div>
	<script language="javascript">
	    var recordKey="";
	    var preRow = null;
		$('tbody tr').bind('click', function() {
	
			var rowIndex = $(this).prevAll().length+1;
			if(rowIndex <1) return;
			
			if(preRow != null){
				preRow.removeClass("active");
			}
			$(this).addClass("active");
			preRow = $(this);
			
			recordKey=$(this).find("td").eq(1).text();
			// 行单击后事件(传入行号，应用ID,应用名称信息)

		});
	</script>
</body>
</html>
